/*
 * Copyright (c) 2016-2017 fulihui.com All right reserved
 * Project: user-core-trunk
 * File name: PropertiesServiceClientInpl.java
 */

package com.fulihui.usercore.common.integration.impl;

import com.fulihui.systemcore.api.PropertiesService;
import com.fulihui.systemcore.condition.PropertiesCondition;
import com.fulihui.systemcore.dto.PropertiesDTO;
import com.fulihui.usercore.common.integration.PropertiesServiceClient;
import org.apache.dubbo.config.annotation.Reference;
import org.near.servicesupport.request.RequestBuilder;
import org.near.servicesupport.result.TMultiResult;
import org.near.servicesupport.util.ServiceResultUtil;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author Willard.Hu on 2017/3/22 0022.
 */
@Component
public class PropertiesServiceClientInpl implements PropertiesServiceClient {
    @Reference(version = "1.0.0", check = false)
    private PropertiesService propertiesService;

    @Override
    public List<PropertiesDTO> query(PropertiesCondition condition) {
        TMultiResult<PropertiesDTO> res = propertiesService.query(RequestBuilder.buildT(condition));
        ServiceResultUtil.checkResult(res);
        return res.getValues();
    }
}
